﻿using LeRenard.Core.Numbers;
using System;

//
// This example demonstrates the use of IRange<T> and IRangeCycler<T> with IRange<int>/IRangeCycler<int>.
//

namespace LeRenard.Core.IRangeExample
{
    class Program
    {
        static void Main(string[] args)
        {
            // Create a range
            var range = new Int32Range(0, 100);

            // Create cyclers
            var normalCycler = new Int32RangeCycler(range);
            var randomCycler = new RandomInt32RangeCycler(range);            

            do
            {
                // Normal cycler
                Console.WriteLine("Cycle between {0} and {1}:", normalCycler.Range.Minimum, normalCycler.Range.Maximum);
                Console.WriteLine("--> Next: {0}", normalCycler.Next());
                Console.WriteLine("--> Peek: {0}", normalCycler.Peek());

                // Random cycler
                Console.WriteLine("Random between {0} and {1}:", randomCycler.Range.Minimum, randomCycler.Range.Maximum);
                Console.WriteLine("--> Next: {0}", randomCycler.Next().ToString());
                Console.WriteLine("--> Peek: {0}", randomCycler.Peek().ToString());
            } while (!Console.ReadLine().Trim().ToLower().Equals("exit"));
        }
    }
}